package com.littleken.foodieService.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.littleken.foodieMapper.CarouselMapper;
import com.littleken.foodiePojo.domain.CarouselDO;
import com.littleken.foodieService.CarouselService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/*
 * Create by littleken on 2020/11/24 10:00
 */
@Service
public class CarouselServiceImpl implements CarouselService {

    @Resource
    private CarouselMapper carouselMapper;


    @Override
    public List<CarouselDO> getAllCarousel(Integer isShow) {
        List<CarouselDO> carouselList = Lists.newArrayList();
        QueryWrapper<CarouselDO> wrapper = new QueryWrapper();
        if (isShow != null){
            wrapper.eq("is_show",isShow);
        }
        wrapper.orderBy(true, false, "sort");
        carouselList = carouselMapper.selectList(wrapper);
        return carouselList;
    }
}
